home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / evaluate.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  1.5 KB  |  72 lines

  1. <!--- This shows the use of DE and Evaluate --->
  2.  
  3. <HTML>
  4.  
  5. <HEAD>
  6.  
  7. <TITLE>
  8. Evaluate Example
  9. </TITLE>
  10.  
  11. </HEAD>
  12.  
  13. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  14. <BODY  bgcolor="#FFFFD5">
  15.  
  16. <H3>Evaluate Example</H3>
  17.  
  18. <P>This file has been disabled for online viewing. Please use your copy of ColdFusion to view this example. 
  19. <!---
  20. <CFIF IsDefined("form.myExpression")>
  21. <H3>The Expression Result</H3>
  22.  
  23. <CFTRY>
  24. <!--- Evaluate the expression --->
  25. <CFSET myExpression = Evaluate(form.myExpression)>
  26.  
  27. <!--- Use DE to output the value of the variable, unevaluated --->
  28. <CFOUTPUT>
  29. <I>The value of the expression #Evaluate(DE(form.MyExpression))#
  30. is #MyExpression#.</I>
  31. </CFOUTPUT>
  32.  
  33.  
  34. <!--- specify the type of error for which we are fishing --->
  35. <CFCATCH TYPE="Any">
  36. <!--- the message to display --->
  37.     <H3>Sorry, there's been an <B>Error</B>.
  38.     Try a simple expression, such as "2+2".</H3>
  39. <CFOUTPUT>
  40. <!--- and the diagnostic message from the Cold
  41. Fusion server --->
  42.     <P>#CFCATCH.message#
  43. </CFOUTPUT>
  44. </CFCATCH>
  45.  
  46. </CFTRY>
  47.  
  48.  
  49. </CFIF>
  50.  
  51. <H3>Simple Expression Evaluator</H3>
  52. <P>Input a simple expression (e.g., 2+2) or 
  53. A simple expression combined with CFML (e.g., 
  54. 32 MOD 9) and see the result, as well as the 
  55. name of the variable used to hold the information.
  56.  
  57.  
  58. <FORM ACTION="evaluate.cfm" METHOD="POST">
  59. <INPUT TYPE="Text" NAME="MyExpression" VALUE="2 + 2">
  60.  
  61. <INPUT TYPE="Submit" NAME="" VALUE="Evaluate my expression">
  62.  
  63.  --->
  64.  
  65.  
  66. </FORM>
  67.  
  68.  
  69. </BODY>
  70.  
  71. </HTML>       
  72.